package com.qigao.mall.service.impl;

import com.qigao.mall.api.TradeDetailService;
import com.qigao.mall.jdbc.mapper.TbTradeDetailMapper;
import com.qigao.mall.jdbc.model.TbBonusDetail;
import com.qigao.mall.jdbc.model.TbTradeDetail;
import com.qigao.mall.jdbc.model.TbTradeDetailEntity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

/**
 * @author luiz
 * @Title: com.qigao.mall.service.impl
 * @ProjectName market-parent
 * @date 2020-06-2020-06-19 14:47
 * @Description:
 */
@Service
public class TradeDetailServiceImpl implements TradeDetailService {
    @Resource
    private TbTradeDetailMapper tbTradeDetailMapper;

    @Override
    public void insertBatch(List<TbTradeDetailEntity> tbTradeDetails) {
        tbTradeDetailMapper.insertBatch(tbTradeDetails);
    }

    @Override
    public void insert(TbTradeDetail tbTradeDetail) {
        tbTradeDetailMapper.insertSelective(tbTradeDetail);
    }

    @Override
    public List<TbBonusDetail> selectUserTradeGroup(Date lastMonthStartDate, Date lastMonthEndDate, String compNo) {
        return    tbTradeDetailMapper.selectUserTradeGroup(lastMonthStartDate,lastMonthEndDate,compNo);
    }

    @Override
    public List<TbBonusDetail> selectCompTradeGroup(Date lastMonthStartDate,Date lastMonthEndDate) {
        return    tbTradeDetailMapper.selectCompTradeGroup(lastMonthStartDate,lastMonthEndDate);
    }

    @Override
    public void updateBatch(List<TbTradeDetail> tbTradeDetails) {
        tbTradeDetailMapper.updateBatch(tbTradeDetails);
    }

    @Override
    public TbTradeDetail selectLastTradeDetailByUserNo(String userNo) {
        return tbTradeDetailMapper.selectLastTradeDetailByUserNo(userNo);
    }

    @Override
    public List<TbBonusDetail> selectUserLevelByCompNo(String compNo) {
        return tbTradeDetailMapper.selectUserLevelByCompNo(compNo);
    }

    @Override
    public List<TbTradeDetail> selectCompTrade(Date lastMonthStartDate, Date lastMonthEndDate) {
        return    tbTradeDetailMapper.selectCompTrade(lastMonthStartDate,lastMonthEndDate);
    }


}
